<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let tempStr = `
        <h1>我今天意外收获了{{thing}}，非常{{mood}}！</h1>
            `;
        let data = {
            thing: '腾讯的offer',
            mood: '开❤'
        };
        function render(templateStr, data) {
            return templateStr.replace(/\{\{(\w+)\}\}/g,function(findStr,$1){
                return data[$1]
            })
        }
        let result =  render(tempStr,data)
        console.log(result);
        
    </script>
</body>
</html>